<include file="public@storage"/>
<link rel="stylesheet" href="__STATIC__/storage/print/print.css"/>
<style>
    .btn-default {
        border-color: rgb(220, 228, 236);
    }
</style>
</head>
<body>
<div>
    <div align="center" style="width: 100% ;">
        <p align="center" style="font-size: 25px;">标签生成 <a href="{:url('storage/Tag/copy')}" style="font-size: 25px;">标签复制</a><a href="{:url('storage/Tag/tag')}" style="font-size: 25px;">  标签打印</a></p>
        <form class="form-horizontal table" style="padding-left:50px;padding-right: 50px"  action="">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 align="left" class="panel-title">标签生成</h3>
                </div>
                <div class="panel-body" style="padding-top:30px;">
                    <div style="float: left;margin-left: 25%;">
                        <div class="form-group">
                            <label class="col-md-2 control-label">物&nbsp;料&nbsp;号&nbsp;：</label>
                            <div class="col-md-10">
                                <input type="text" name="materiel" id="materiel" class="form-control" placeholder="物料号" onchange="newId()">
                            </div>
                        </div>
                        <br/>
                        <input type="hidden" id="supplierId">
                        <div class="form-group">
                            <label class="col-md-2 control-label">厂&nbsp;商&nbsp;号&nbsp;：</label>
                            <div class="col-md-10" style="position: relative;left: 20px;">
                                <select id="supplierName" name="supplierName" class="selectpicker  form-control" title="厂商名" data-live-search="true" onchange="getSupplier()">
                                    <option value="" selected = "selected"></option>
                                    <volist name="supplierInfo" id="vo">
                                        <option value="{$vo.supplier_id}">{$vo.company_name}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <br/>
                        <div class="form-group">
                            <label class="col-md-2 control-label">数&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;量&nbsp;：</label>
                            <div class="col-md-10">
                                <input type="text" name="num" id="num" class="form-control" placeholder="请输入数量">
                            </div>
                        </div>
                        <br/>
                    </div>
                    <div class="preview" id="preview" style='float:left;margin-left: 200px;'>
                        <table id="printContent"
                               style="font-size:5px;;width: 80mm;height: 50mm;word-wrap: break-word;word-break: break-all;margin: 0">
                            <tr>
                                <td id="img" style="text-align: center;"></td>
                            </tr>
                            <tr>
                                <td>物&nbsp;料&nbsp;号:<span id="sub_materiel_id"></span>
                                <td>
                            </tr>
                            <tr>
                                <td style="width: 60mm">物料名称:<span id="sub_materiel_name"></span></td>
                            </tr>
                            <tr>
                                <td style="width: 60mm">规格型号:<span id="format"></span></td>
                            </tr>
                            <tr>
                                <td style="width: 60mm">厂商:<span id="company_name"></span></td>
                            </tr>
                            <tr>
                                <td>检验日期:<span id="date"></span><span style="margin-left: 3mm">数&nbsp;量:<span id="count"></span></span></td>
                            </tr>
                            <tr>
                                <td>检验结果:<span id="result"></span><span style="margin-left: 20mm">检验员:<span id="checker"></span></span></td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
            <div style="text-align: center;margin: 10px;">
                <button type="submit" class="mui-btn mui-btn--raised mui-btn--primary" onclick="createPage(0)">确认打印</button>
            </div>
        </form>
    </div>
</div>
</body>
<script src="__STATIC__/storage/barcode/Barcode.js"></script>
<script src="__STATIC__/storage/print/printThis.js"></script>
<script src="__STATIC__/storage/print/print.js"></script>
<script>

    var newId = function () {
        var url = "{:url('storage/Tag/getMaterielInfo')}";
        var data = {materiel:$('#materiel').val()};
        createId(url,data);
    };

    var getSupplier = function () {
        $('#supplierId').val($('#supplierName').val());
        console.log($('#supplierName').val());
        var supplierName = $("#supplierName").find("option:selected").text();
        $('#company_name').text(supplierName);
    };

</script>
</html>